// 节 表


const { STRING, INTEGER, DATE } = require("sequelize");

const sequelize = require("../sequelize");

const Section = sequelize.define("Section",{
    title:{
        type:STRING(50),
        allowNull:false,
        unique:true,
        comment:"节名称"
    },
    createdate:{
        type:DATE,
        comment:"创建时间"
    },
    update:{
        type:DATE,
        comment:"修改时间"
    },
    creadator:{
        type:DATE,
        comment:"修改者"
    },
    updator:{
        type:DATE,
        comment:"修改者"
    },
    chapterid:{
        type:INTEGER(36),
        comment:"章id 对应 chapter 中的 id"
    }
})

Section.associate = function(){
    Section.bolongsTo(sequelize.Chapter,{
        foreignKey:"chapterid",
        target:"id"
    })
}

module.exports = Section